#!/usr/bin/env python


import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from runtest_dalton import Filter, TestRun

test = TestRun(__file__, sys.argv)

f = Filter()

# Energy
f.add(from_re = 'QM\/MM \"QMMM\" calculation converged',
      num_lines = 13,
      rel_tolerance = 1.0e-8)

f.add(re = 'gamma\([XYZ]\;[XYZ]\,[XYZ]\,[XYZ]\)',
      abs_tolerance = 1.0e-3)

f.add(re = 'Averaged gamma parallel to the applied field is',
      rel_tolerance = 1.0e-8)

test.run(['qmmm7.dal'], ['ch2o_cc-pvdz.mol'], f={'out': f}, args='-put POTENTIAL.INP',
         accepted_errors=['cubic response not implemented for QMMM.'])

sys.exit(test.return_code)
